package com.adp.interceptor;

import com.adf.config.component.application.report.ReportBean;
import com.adf.system.ReportRequest;
import com.adf.system.component.application.report.configbean.editablereport.AbsEditableReportEditDataBean;
import com.adf.system.intercept.AbsInterceptorDefaultAdapter;

import java.util.Map;

/**
 * 业务对象拦截器
 * @author zk
 *
 */
public class ObjCondition extends AbsInterceptorDefaultAdapter {

	@Override
	public int doSavePerRow(ReportRequest rrequest, ReportBean rbean,
                            Map<String, String> mRowData, Map<String, String> mParamValues,
                            AbsEditableReportEditDataBean editbean) {
		
		return super.doSavePerRow(rrequest, rbean, mRowData, mParamValues, editbean);
	}
	
	@Override
	public Object beforeLoadData(ReportRequest rrequest, ReportBean rbean,
                                 Object typeObj, String sql) {
		/*String objid = rrequest.getStringAttribute("pid","");
		if(objid != null && !"".equals(objid) && !"0".equals(objid)){
			rrequest.getRequest().getSession().setAttribute("pid",objid);//在session中存入pid的值，以便后面的查询条件能从中取到数据。
		}else{
			rrequest.getRequest().getSession().setAttribute("pid","");
		}
*/
		return super.beforeLoadData(rrequest, rbean, typeObj, sql);
	}
		
	@Override
	public void doStart(ReportRequest rrequest, ReportBean rbean) {
		String objid = rrequest.getStringAttribute("pid","");
		if(objid != null && !"".equals(objid) && !"0".equals(objid)){
			rrequest.getRequest().getSession().setAttribute("pid",objid);//在session中存入pid的值，以便后面的查询条件能从中取到数据。
		}else{
			rrequest.getRequest().getSession().setAttribute("pid","");
		}
		super.doStart(rrequest, rbean);
	}
}